home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
asmexam.arc
/
STRING.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-08-09
|
1KB
|
54 lines
PAGE 55,132
CODE SEGMENT PARA
ASSUME CS:CODE,DS:CODE,ES:CODE
XWORD DW 4849H
XWORD1 DW 3132H
XWORD2 DW ?
XBYTE DB 'A'
XBYTE1 DB 'THIS IS A STRING OF LENGTH 29'
XBYTE2 DB 29 DUP(?)
AXW DD XWORD
AXW1 DD XWORD1
AXW2 DD XWORD2
AXB DD XBYTE
AXB1 DD XBYTE1
AXB2 DD XBYTE2
ORG 100H
START:
LDS SI,AXB ; LOAD DS:SI REG WITH ADDRESS OF XBYTE
LODS XBYTE ; LOAD AL FROM [DS::SI]
LDS SI,AXW
LODS XWORD ; LOAD AX FROM [DS::SI]
LDS SI,AXW1
LODSB ; LOAD AL FROM [DS::SI]
LES DI,AXB2
MOV CX,2
STOS XBYTE ; STORE AL AT [ES::DI]
STOS XWORD ; STORE AX AT [ES::DI]
STOSW ; STORE AX AT [ES::DI]
REP STOSB ; STORE AL AT ES:DI FOR CX TIMES
MOVS XBYTE2,XBYTE1 ; MOV BYTE ES:DI <-- DS:SI
MOVS XWORD2,XWORD1 ; MOV WORD ES:DI <-- DS:SI
MOVSB ; MOV BYTE ES:DI <-- DS:SI
MOV CX,3
REP MOVSW ; REPEAT MOVSW CX TIMES
SCAS XBYTE ; TEST AL WITH THE BYTE AT ES:DI
REPE SCASB ; REPEAT STRING COMPARE WHILE =
REPNE SCASW ; REPEAT STRING COMPARE WHILE <>
CMPS XWORD,XWORD1 ; COMPARE WORD AT DS:SI TO ES:DI
MOV CX,1
REPE CMPSW ; COMPARE WORDS WHILE = AND CX <> 0
MOV CX,1
REPNE CMPSB ; COMPARE BYTES WHILE <> AND CX <> 0
CODE ENDS
END START